Computing presented V-categories with matrix mult

Monoidal closed preorders(11)
Closed SMP(1)
Self-enriched category(1)

A category \(\mathcal{V}\) that is enriched in itself.

  • For every \(v,w \in Ob(\mathcal{V})\) we can define \(\mathcal{V}(v,w)\) as \((v \multimap w) \in \mathcal{V}\)

  • For this to be an enrichment, we need to check the two conditions.

    • The first condition \(I \leq \mathcal{X}(x,x) = x \multimap x\) is satsified because \(I \otimes x \leq x\)

    • The second condition is satisfied by P2.87e

Linked by

Cost is closed(1)
  • The symmetric monoidal preorder \(\mathbf{Cost}:=([0,\infty],\geq,0,+)\) is monoidal closed.

  • For any \(x,y \in [0,\infty]\), define \(x \multimap y := max(0,y-x)\)

  • Then, for any \(a,x,y\), we have \(a+x\geq y\) iff \(a \geq y-x\) iff \(max(0,a)\geq max(0,y-x)\) iff \(a \geq (x \multimap y)\)

  • We can use this to define a notion of subtraction in Cost.

Linked by

Chemistry closed resource theory(1)
  • What would a monoidal closed structure mean for the resource theory of chemistry?

  • For any two material collections, one can form a material collection \(c \multimap d\) with the property that, for any a one has \(a + c \rightarrow d\) iff \(a \rightarrow (c \multimap d)\)

  • Concretely, say we have \(2 H_2O + 2 Na \rightarrow 2 NaOH + H_2\), we must also have \(2H_2O \rightarrow (2Na \multimap (2NaOH+H_2))\)

  • From two molecules of water, you can form a certain substance. This doesn’t make sense, so maybe this symmetric monoidal preorder is not closed.

  • Alternatively, think of the substance \(2Na \multimap (2NaOH+H_2)\) as a potential reaction, that of converting sodium to sodium-hyroxide+hydrogen. Two molecules of water unlock that potential. NOCARD

SMP currying(2)
Proof(1)
  • The meaning of \((- \otimes v) \dashv (v \multimap -)\) is exactly the condition of \(\multimap\) in a closed symmetric monoidal preorder.

  • This follows from (1), using the fact that left adjoints preserve joins.

  • This follows from (1) using the alternative characterization of Galois connections.

    • Alternatively, start from definition of closed symmetric monoidal preorder and substitute \(v \multimap w\) for \(a\), and note by reflexivity that \((v \multimap w) \leq (v \multimap w)\)

    • Then we obtain \((v \multimap w) \otimes v \leq w\) (by symmetry of \(\otimes\) we are done)

  • Since \(v \otimes I = v \leq v\), then the closed condition means that \(v \leq I \multimap v\)

    • For the other direction, we have \(I \multimap v = I \otimes (I \multimap v) \leq v\) by (3)

  • We need \(u \otimes (u \multimap v) \otimes (v \multimap w) \leq w\)

    • This follows from two applications of the third part of this proposition.

Suppose \(\mathcal{V}:=(V,\leq,I,\otimes,\multimap)\) is a closed symmetric monoidal preorder.

  • For every \(v \in V\) the monotone map \((V, \leq) \xrightarrow{-\otimes v}(V,\leq)\) is left adjoint to \((V, \leq)\ \xrightarrow{v \multimap -} (V,\leq)\)

  • For any element \(v \in V\) and a subset of elements \(A \subseteq V\), if the join \(\bigvee A\) exists, then so does \(\bigvee_{a \in A} v \otimes a\) and we have \((v \otimes \bigvee A)\cong \bigvee_{a \in A} v \otimes a\)

  • \(\forall v,w \in V: v \otimes (v \multimap w) \leq w\)

  • \(\forall v \in V: v \cong (I \multimap v)\)

  • \(\forall u,v,w \in V: (u \multimap v) \otimes (v \multimap w) \leq (u \multimap w)\)

Linked by

Exercise 2-82(2)

Prove that a symmetric monoidal preorder is closed iff, given any \(v \in V\), the map \(V \xrightarrow{(-\otimes v)}V\) given by multiply with v has a right adjoint. We write this adjoint \(V \xrightarrow{(v \multimap -)}V\):

  1. Show that \(V \xrightarrow{(-\otimes v)}V\) is monotone.

  2. Supposing that \(\mathcal{V}\) is closed, show that \(\forall v,w \in V: ((v \multimap w)\otimes v) \leq w\)

  3. Show that \((v \multimap -)\) is monotone.

  4. Conclude that a symmetric monoidal preorder is closed iff the monotone map \((- \otimes v)\) has a right adjoint.

Solution(1)
    • Given the monotonicity constraint of \(\otimes\)

    • And reflexivity: \(v \leq v\), we have:

    • \(x_1 \leq y_1\) implies that \((x_1 \otimes v) \leq (y_1 \otimes v)\)

  1. Substitute \(v \multimap w\) for \(a\) into the closed property equation, to get \(((v \multimap w)\otimes v) \leq w \iff v \multimap w \leq v \multimap w\) (the RHS is true by reflexivity, so the LHS must be true).

  2. Need to show: if we assume \(x \leq y\) then we can conclude \((v \multimap x) \leq (v \multimap y)\)

    • From the previous part, we have \((v \multimap x) \otimes v \leq x\) and \((v \multimap y) \otimes v \leq y\)

    • Assuming the antecedant \(x \leq y\), and given transitivity, we have \((v \multimap x) \otimes v \leq (v \multimap y) \otimes v\)

    • Because the \(\otimes\) operation must be monotonic, the consequent follows.

  3. A Galois connection requires that both maps be monotone and that they satisfy \(f(p)\leq q\) iff \(p \leq g(q)\). This is the relation captured by the closed property equation, and both maps were shown to be monotone.

Exercise 2-85(2)

Show that \(\mathbf{Bool}=(\mathbb{B},\leq, true, \land)\) is monoidal closed.

Solution(1)
  • Our translation is: \(\otimes \mapsto \land,\ \leq \mapsto \implies\)

  • Condition for being closed is then:

  • \(\forall a,v,w:\) \((a \land v) \implies w\) iff \(a \implies (v \multimap w)\)

  • On the LHS, we have the truth table:

    a v w \((a \land v) \implies w\)
    F F F T
    F F T T
    F T F T
    F T T T
    T F F T
    T F T T
    T T F F
    T T T T
  • In order to define \(v \multimap w\) in a way consistent with this, we need it to only be false when \(v=true, w=false\), which is the truth condition for \(v \implies w\).

  • This is consistent with a ‘single use v-to-w converter’ analogy.

Linked by

Quantales(13)
Quantale(1)
Cost quantale(1)
  • We saw that Cost is monoidal closed in Example 2.83

  • To check if Cost is a quantale, we take an arbitrary set of elements and ask if it has a join.

  • Because \(\geq\) is a total order, we can take the infimum or greatest lower bound, as the join.

    • \(\bigvee\{2.5,2.05,2.005,...\} = 2\).

  • We need a \(0\), which is something which is related to everything (the first join condition is vacuous). Because the preorder relation is \(\geq\) in Cost we need something greater than everything, so \(0 = \infty\).

  • Thus Cost is a quantale.

All joins implies all meets(2)

Let \((P,\leq)\) be a preorder. It has all joins iff it has all meets.

Proof(1)
  • Meets and joins are dual, so it suffices to prove one of the directions (the opposite category shows that having all meets having all joins, if we are able to prove that having all joins means having all meets in the original preorder).

  • Suppose there are all joins and \(A \subseteq P\) is a subset for which we want the meet.

  • Consider the set \(M_A := \{p \in P\ |\ \forall a \in A: p \leq a \}\) (everything below all of \(A\) - these are candidates for the meet of \(A\))

  • The first condition for the meet is satisfied by all. We get the actual meet by taking \(\bigvee M_A\) which is guaranteed to exist. Because this element is greater than or equal to all elements that are \(\leq A\), it satisfies the second condition for the meet.

Linked by

Quantale is SMP with all joins(2)

Suppose \(\mathcal{V}=(V,\leq,I,\otimes)\) is a symmetric monoidal preorder that has all joins.

  • Then \(\mathcal{V}\) is closed, i.e. has a \(\multimap\) operation and hence is a quantale, iff \(\otimes\) distributes over joins

  • i.e. if Eq (2) from P2.87 holds: \((v \otimes \bigvee A)\cong \bigvee_{a \in A} v \otimes a\).

Proof(1)
  • We proved one direction in P2.87

  • We need to show that \((v \otimes \bigvee A)\cong \bigvee_{a \in A} v \otimes a\) (and all joins existing) implies that there exists a \(\multimap\) operation that satisfies the closed property: \(\forall a,v,w \in V: (a \otimes v) \leq w\) iff \(a \leq (v \multimap w)\).

  • The adjoint functor theorem for preorders states that monotone maps preserve joins iff they’re left adjoint, so \(V \xrightarrow{-\otimes v} V\) must have a right adjoint g, which, being a Galois connection, will satisfy the property \((a \otimes v) \leq w \iff a \leq g(w)\) (this is the monoidal closed property).

  • Let’s rename \(g \equiv v \multimap -\). The adjoint functor theorem even gives us a construction for the right adjoint, namely: \(v \multimap w:=\bigvee\{a \in V\ |\ a \otimes v \leq w\}\).

Linked by

Exercise 2-92(2)
  1. What is \(\bigvee \varnothing\), called \(0\), in the case of:

    • \(\mathcal{V}=\mathbf{Bool}=\{\mathbb{B},\leq, true,\land\}\)

    • \(\mathcal{V}=\mathbf{Cost}=([0,\infty],\geq,0,+)\)

  2. What is the join \(x \vee y\) for Bool and Cost?

Solution(1)
  1. \(False\) and \(\infty\) respectively

  2. Logical or and \(min\) respectively

Exercise 2-93(2)

Show that Bool is a quantale

Solution(1)

The joins all exist:

  • nontrivial ones: \(\varnothing \mapsto False, \{True,False\}\mapsto True\)

Exercise 2-94(2)

Recall the power set symmetric monoidal preorder \((P(S),\subseteq, S, \cap)\) Is this a quantale?

Solution(1)

Yes, \(0=\varnothing\) (it is related to everything) and the join of any pair of subsets is well-defined as their union. By Proposition 2.98, this means it is a quantale.

Matrix multiplication in a quantale(9)

The identity \(\mathcal{V}\) matrix, \(X \times X \xrightarrow{I_X} \mathcal{V}\) has \(I\) on the diagonal entries and \(0\) on the off-diagonal entries.

Quantale matrix(1)

A matrix with entries in \(\mathcal{V}\), where \(\mathcal{V}=(V, \leq, \otimes, I)\) is a quantale. (A \(\mathcal{V}\) matrix). Matrix multiplication between \(\mathcal{V}\) matrices

  • Need two sets, and function \(X \times Y \xrightarrow{M} V\). Call \(M(x,y)\) the (x,y)th entry.

  • We can multiply \(X \times Y \xrightarrow{M} V\) and \(Y \times Z \xrightarrow{N} V\) to get a new \(\mathcal{V}\) matrix \(X \times Z \xrightarrow{M*N} V\).

    • \((M*N)(x,z)(x,z)\) defined as \(\bigvee_y\ M(x,y)\otimes N(y,z)\)

    • Note that this is similar to the standard matrix multiplication, with \(\bigvee \mapsto \Sigma, \otimes \mapsto *\)*

Linked by

Abstract matrix multiplication(1)

Let \(\mathcal{V}=\mathbf{Bool}\). Here is matrix multiplication \(M*N\) with \(X=\bar{3}, Y=\bar{2},Z=\bar{3},M=X\times Y\rightarrow Z, N=Y\times Z\rightarrow B\).

\(X\)

F F
F T
T T

\(Y\)

T T F
T F T

\(X*Y\)

F F F
T F T
T T T

Exercise 2-103(2)

Write the 2x2 identity matrices for each of the quantales:

  1. \((\mathbb{N},\leq,1,*)\)

  2. \(\mathbf{Bool}:=(\mathbb{B},\leq,true,\land)\)

  3. \(\mathbf{Cost}:=([0,\infty],\leq,0,+)\)

Solution(1)
  1. 1 0
    0 1
  2. T F
    F T
  3. 0 \(\infty\)
    \(\infty\) 0
Exercise 2-104(2)

Let \(\mathcal{V}=(V,\leq,I,\otimes,\multimap)\) be a quantale. Prove:

  1. The identity law

    • For all \(\mathcal{V}\) matrices \(X\times Y\xrightarrow{M}V\), one has \(I_X * M = M\)

  2. The associative law

    • For any matrices \(W \times X \xrightarrow{M} V, X \times Y \xrightarrow{N} V, Y \times Z \xrightarrow{P} V\), one has \((M*N)*P=M*(N*P)\)

Solution(1)
    • \(\forall v \in \mathcal{V}\), we have \(0 \otimes v \cong 0\).

      • \(0 \otimes v\)

      • \(\cong v \otimes 0\)symmetry

      • \(= v \otimes \bigvee_{a \in \varnothing} a\)definition of \(0\)

      • \(\cong \bigvee_{a \in \varnothing} v \otimes a\) \(-\otimes x\) preserves joins b/c it is left adjoint

      • \(= 0\)definition of 0

    • Plug this into definition of matrix multiplication

      • \(I_X * M(x,y)\)

      • \(= \bigvee_{x'}I_x(x,x')\otimes M(x',y)\)definition of matrix multiplication in a quantale

      • \(=(I_x(x,x)\otimes M(x,y))\vee(\bigvee_{x'\ne x}I_x(x,x')\otimes M(x',y))\)split join into two cases

      • \(=(I\otimes M(x,y))\vee(\bigvee_{x'\ne x}0\otimes M(x',y))\)Definition of identity matrix

      • \(=M(x,y)\vee 0\) join of a singleton set

      • \(=M(x,y)\)Zero is the least element in \(\mathcal{V}\)

    • Need to show \(\underset{y \in Y}\bigvee (\underset{x\in X}\bigvee M(w,x)\otimes N(x,y))\otimes P(y,z)\) is the same as \(\underset{x \in X}\bigvee M(w,x)\otimes(\underset{y \in Y}\bigvee N(x,y) \otimes P(y,z))\) for all \(w \in W,z \in Z\)

    • The associativity of \(\otimes\) and the fact it preserves joins b/c it is left adjoint lets us shift the symbols around appropriately.

Linked by

Exercise 2-105(2)

Consider the distance matrix represented by this graph from Exercise 2.60:

\(\rightarrow\) A B C D
A 0 6 3 11
B 2 0 5 5
C 5 3 0 8
D 11 9 6 0

Compute the distance matrix by power iteration of the matrix of the presentation.

Solution(1)
\(M\) A B C D
A 0 \(\infty\) \(\infty\) 3
B 2 0 5 \(\infty\)
C \(\infty\) \(\infty\) 0 6
D \(\infty\) 3 \(\infty\) 0

\(M^2\) A B C D
A 0 6 \(\infty\) 3
B 2 0 5 11
C \(\infty\) 9 0 6
D 5 3 8 0

After this, \(M^n\) is the \(\rightarrow\) matrix